/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
/**
 * \file
 * \brief MaCI Logger Main Frame and filename dialog headers.
 * \author Matthieu Myrsky <matthieu.myrsky@tkk.fi>
 * \author wxFormBuilder (Autogenerated base code)
 *
 * $Id: MaCI_Logger_MainFrame.h,v 1.16 2009-06-23 13:30:20 morsko Exp $
 *
 */
#ifndef __MaCI_Logger_MainFrame__
#define __MaCI_Logger_MainFrame__

/**
@file
Subclass of MainFrame, which is generated by wxFormBuilder.
*/

#include "MaCI_Logger_GUI.h"
#include "MaCICtrlClient.hpp"

#include "ownutils.h"
#include "Component.hpp"
#include <wx/timer.h>

//*****************************************************************************
#define GIMI_CLIENT_API (20000)
#include "gimi.h"
#undef GIMI_CLIENT_API
//*****************************************************************************
#include "LoggerGenerator.hpp"
///MACI INTERFACES
#include "RangingClient.hpp"
#include "PositionClient.hpp"
#include "SpeedCtrlClient.hpp"
#include "IMUClient.hpp"
#include "EnergyClient.hpp"
#include "CoordinateDriveClient.hpp"
#include "ImageClient.hpp"

///LOGGER TYPES
#include "Logger.hpp"
#include "RangingLogger.hpp"
#include "PositionLogger.hpp"
#include "SpeedCtrlLogger.hpp"
#include "IMULogger.hpp"
#include "EnergyLogger.hpp"
#include "WirelessLogger.hpp"
#include "CoordinateDriveLogger.hpp"
#include "ImageLogger.hpp"
/*namespace gimi {
  class GIMI;
}
*/
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE(MY_EVENT_UPDATESERVICELIST, -1)
END_DECLARE_EVENT_TYPES();
/** Implementing MainFrame */
class MaCI_Logger_MainFrame : public MainFrame,
                              public Gimbo::CComponent{
 DECLARE_EVENT_TABLE();
protected:
  // Handlers for MainFrame events.
  void OnServicesDClick( wxCommandEvent& event );
  void OnSelectAllButtonClick( wxCommandEvent& event );
  void OnSelectButtonClick( wxCommandEvent& event );
  void OnDeselectButtonClick( wxCommandEvent& event );
  void OnButtonStartClick( wxCommandEvent& event );
  void OnStartAllClick( wxCommandEvent& event );
  void OnButtonStopClick( wxCommandEvent& event );
  void OnStopAllClick( wxCommandEvent& event );
  void OnSelectedServicesDClick( wxCommandEvent& event );
  void OnQuitClick( wxCommandEvent& event );
  void OnListSelected( wxListEvent& event );
  void OnListDeselected( wxListEvent& event );
  void OnListRightClick( wxListEvent& event );
  void OnMenuSetFilenameSelected( wxCommandEvent& event );
  void OnAboutSelected( wxCommandEvent& event );
  void OnEveryNthSelected( wxCommandEvent& event );
  //Gimbo
  void OnServiceAssignment(const Gimbo::TServiceAssignmentList &aServiceList);  
 public:
  /** Constructor */
  MaCI_Logger_MainFrame( wxWindow* parent );
  virtual ~MaCI_Logger_MainFrame();
  bool Initialize(gimi::GIMI *aGimiPtr, int aGimboID, int aReportID);
  void Deinitialize(void);
  void UpdateLoggerMenus();
 private:

  void UpdateServiceList(wxCommandEvent &aEvent);
  void OnAdditionalInfoUpdate( wxTimerEvent &event);///< Timer hit!
 


  gimi::GIMI *iGIMIPtr; 
  Gimbo::TServiceAssignmentList iServiceList;
  Gimbo::TServiceAssignmentList iNewServiceList;
  MaCI::MaCICtrl::CMaCICtrlClient *iMaCICtrlClient;
  LoggerGenerator *iLoggerGenerator;
  std::map<Logger *, wxMenu *> iMenuMap;


  std::string iVersionNumber;
  wxTimer iAdditionalInformationTimer;
  
  
};


class MaCI_Logger_Filename_Dialog: public Filename_Dialog
{
 public:

  MaCI_Logger_Filename_Dialog(wxWindow* parent,
                              Logger *aLogger,
                              std::string aNameOfService);
  virtual ~ MaCI_Logger_Filename_Dialog();
 protected:
  void OnButtonOK( wxCommandEvent& event );
  void OnButtonCancel( wxCommandEvent& event );
  void OnButtonDefaultName( wxCommandEvent& event );
 private:
  Logger *iLogger;

};



class MaCI_Logger_Question_Dialog:public Question_Dialog
{
 public:
  MaCI_Logger_Question_Dialog(wxWindow *aParent,
                              Logger *aLogger,
                              std::string aNameOfService,
                              std::string aQuestion);

  virtual ~MaCI_Logger_Question_Dialog();

 protected:
  void OnOk( wxCommandEvent& event );
  void OnCancel( wxCommandEvent& event );
 private:
  Logger *iLogger;

};

class MaCI_Logger_Error_Dialog:public Error_Dialog
{
 public:
  MaCI_Logger_Error_Dialog(wxWindow *aParent,
                           std::string aErrorText);

  virtual ~MaCI_Logger_Error_Dialog();

 protected:
  void OnOk( wxCommandEvent& event );

};
#endif // __MaCI_Logger_MainFrame__
